
public class DuckSimulator {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		DuckSimulator simulator = new DuckSimulator();
		
		AbstractDuckFactory duckFactory = new CountingDuckFactory();
		simulator.simulate(duckFactory);

	}
		
	void simulate(AbstractDuckFactory duckFactory)
	{
		IQuackable mallardDuck = duckFactory.createMallardDuck();
		IQuackable redheadDuck = duckFactory.createRedheadDuck();
		IQuackable DuckCall = duckFactory.createDuckCall();
		IQuackable rubberDuck = duckFactory.createRubberDuck();
		IQuackable gooseDuck = new GooseAdapter(new Goose());
		
		System.out.println("\nDuck Simulator : With Abstract Factory");
		
		simulate(mallardDuck);
		simulate(redheadDuck);
		simulate(DuckCall);
		simulate(rubberDuck);
		simulate(gooseDuck);
		
		System.out.println("The ducks quacked " + QuackCounter.getQuacks() + "times");
	}
	
	void simulate(IQuackable duck)
	{
		duck.quack();
	}
}
